package com.pany.rememberpass;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import com.pany.rememberpass.Adapter.MyBaseAdapter;
import com.pany.rememberpass.Adapter.MyBaseAdapter2;
import com.pany.rememberpass.bean.ItemBean;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BaseAddpterActivity extends AppCompatActivity {

    private ListView lv;
    private List myList;
    private int[] iamges = {
            R.drawable.test1,
            R.drawable.test2,
            R.drawable.test3,
            R.drawable.test4,
            R.drawable.test5,
            R.drawable.test6,
            R.drawable.test7,
            R.drawable.test8,
            R.drawable.test9
    };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_base_addpter);

        initView();
        initData();
        initEvent();


    }

    private void initEvent() {
        MyBaseAdapter2 myBaseAdapter = new MyBaseAdapter2(myList, this);
        lv.setAdapter(myBaseAdapter);

    }

    private void initData() {

        for (int i = 0; i < 50; i++) {

            ItemBean itemBean = new ItemBean();
            itemBean.setTitle( "这是标题" + i);
            itemBean.setContent("这是内容" + i);
            itemBean.setImgRId(iamges[i % iamges.length]);

            myList.add(itemBean);
        }

    }


    private void initView() {
        lv = findViewById(R.id.lv);
        myList = new ArrayList();
    }
}